#include "math.h"
#include "Constant.h"
struct Vector3
{
	static Vector3* ZeroVector()
	{
		return new Vector3();
	}

public:
	float x;
	float y;
	float z;

	Vector3() : x(0), y(0), z(0)
	{	}

	Vector3(const Vector3 &other) : x(other.x), y(other.y), z(other.z)
	{	}

	Vector3(const float x, const float y, const float z) : x(x), y(y), z(z)
	{	}

	

	~Vector3()
	{	}

	Vector3* CrossProduct(const Vector3 &other)
	{
		return new Vector3(	(y - other.z) - (z - other.y), 
							(z - other.x) - (x - other.z),
							(x - other.y) - (y - other.x));
	}

	float DotProduct(const Vector3 &other)
	{
		float tmp = (x * other.x) + (y * other.y) + (z * other.z);
	}

	void Invert(Axis axis)
	{
		if(axis == X)
		{
			x *= -1;
		}
		if(axis == Y)
		{
			y *= -1;
		}
		
		//z *= -1;
	}

	void Invert()
	{
		//x *= -1;
		y *= -1;
		//z *= -1;
	}

	float Magnitute()
	{
		return sqrt(pow(x, 2) + pow(y, 2) + pow(z, 2));
	}

	void Normalize()
	{
		float length = Magnitute();
		if (length != 0)
		{
			x /= length;
			y /= length;
			z /= length;
		}
	}

	void Zero()
	{
		x = 0;
		y = 0;
		z = 0;
	}
	
	Vector3* operator+ (const Vector3 &v)
	{
		Vector3* tmp = new Vector3(x + v.x, y + v.y, z + v.z);
		return tmp;
	}

	void operator+= (const Vector3 &v)
	{
		x += v.x;
		y += v.y;
		z += v.z;
	}

	Vector3* operator- (const Vector3 &v)
	{
		Vector3* tmp = new Vector3(x - v.x, y - v.y, z - v.z);
		return tmp;
	}

	void operator-= (const Vector3 &v)
	{
		x -= v.x;
		y -= v.y;
		z -= v.z;
	}

	Vector3* operator* (const float scalar)
	{
		Vector3* tmp = new Vector3(x * scalar, y * scalar, z * scalar);
		return tmp;
	}

	void operator*= (const float scalar)
	{
		x *= scalar;
		y *= scalar;
		z *= scalar;
	}

	Vector3* operator/ (const float scalar)
	{
		Vector3* tmp = new Vector3(x / scalar, y / scalar, z / scalar);
		return tmp;
	}

private:
};